package org.example.RabbitListener.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DlxConfig 
{
	@Bean
	public DirectExchange xiriExchange()
	{
		return new DirectExchange("xiri.direct",true,false);
	}

	@Bean
	public Queue xiriQueue()
	{
		return QueueBuilder.durable("xiri.queue")
				.withArgument("x-dead-letter-exchange", "dlx.direct")
				.withArgument("x-dead-letter-routing-key","dlx.key")
				.build();
	}

	@Bean
	public Binding xiriBinding() 
	{
		return BindingBuilder.bind(xiriQueue())
				.to(xiriExchange())
				.with("xiri.key");
	}
}
